genrule(
    name = "generate_version_header",
    srcs = ["//:package.json"],
    outs = ["version.h"],
    cmd = "node $(location //:generate-version-header.js) $(OUTS)",
    tools = ["//:generate-version-header.js"],
)

cc_binary(
    name = "protoc-gen-js",
    srcs = [
        "js_generator.cc",
        "js_generator.h",
        "protoc-gen-js.cc",
        "well_known_types_embed.cc",
        "well_known_types_embed.h",
        ":version.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "@com_google_protobuf//:protobuf",
        "@com_google_protobuf//src/google/protobuf/compiler:code_generator",
        "@com_google_protobuf//src/google/protobuf/io",
        "@com_google_protobuf//src/google/protobuf/io:printer",
        "@com_google_protobuf//src/google/protobuf/io:tokenizer",
        "@com_google_protobuf//:protoc_lib",
        "@abseil-cpp//absl/strings",
        "@abseil-cpp//absl/strings:str_format",
    ],
)


